<template>
	<view>
		<view style="overflow: hidden;">
			<view class="u-m-40 detial">
				<rich-text :nodes="details.content"></rich-text>
			</view>
		</view>
	</view>
</template>

<script>
let timestamp = Date.parse(new Date());
import uniDateformat from 'components/uni-dateformat/uni-dateformat.vue';
let date = new Date(timestamp);
	export default {
		data() {
			return {
				title:'',
				details:'',
				details_data:{},
				year:date.getFullYear()
			}
		},
		components: {
			uniDateformat
		},
		onShow:function(){
		},
		onLoad:function(data){
			this.details_data._id = data._id;
			this.$u.api.getSysArticleInfo(this.details_data).then(res=>{
				uni.setNavigationBarTitle({
					title:res.data.title
				})
				var date = new Date(res.data.inTime*1000);
				res.data.year = date.getFullYear();
				var regex = new RegExp('<img', 'gi');
				res.data.content = res.data.content.replace(regex, `<img style="max-width: 100%; height: auto"`)
				this.details = res.data;
			})
		},
		methods: {

		}
	}
</script>

<style>
	page{
		background-color: #fff;
	}
	.detial img{
		width: 100%;
	}
</style>
